/**
 * 工作流通用JS
 */


//工作流提交方法
function workflowSubmit(billType, billHeadCode, billDepartmentCode){
	$.ajax({
		type: "post",
		url: "web/cuxWorkflowRecord/getApproveWorkflowModal",
		data: {"billType": billType, "billHeadCode": billHeadCode, "billDepartmentCode": billDepartmentCode, "submitFlag": "Y"},
		async: false,
		dataType: "html",
		cache: false,
		success: function(data){
			if(data!=""){
				$("#approveWorkflowModal").html(data);
				$('#approveWorkflowDiv').modal('show');
			}
		},
		error: function(XMLHttpRequest, textStatus, errorThrown){
			redragonJS.alert(textStatus);
		}
	});
}

//工作流审核方法
function workflowApprove(billType, billHeadCode, billDepartmentCode){
	$.ajax({
		type: "post",
		url: "web/cuxWorkflowRecord/getApproveWorkflowModal",
		data: {"billType": billType, "billHeadCode": billHeadCode, "billDepartmentCode": billDepartmentCode, 
			   "submitFlag": "N", "approveFlag": "Y"},
		async: false,
		dataType: "html",
		cache: false,
		success: function(data){
			if(data!=""){
				$("#approveWorkflowModal").html(data);
				$('#approveWorkflowDiv').modal('show');
			}
		},
		error: function(XMLHttpRequest, textStatus, errorThrown){
			redragonJS.alert(textStatus);
		}
	});
}

//工作流驳回方法
function workflowReject(billType, billHeadCode, billDepartmentCode){
	$.ajax({
		type: "post",
		url: "web/cuxWorkflowRecord/getApproveWorkflowModal",
		data: {"billType": billType, "billHeadCode": billHeadCode, "billDepartmentCode": billDepartmentCode, 
			   "submitFlag": "N", "approveFlag": "N"},
		async: false,
		dataType: "html",
		cache: false,
		success: function(data){
			if(data!=""){
				$("#approveWorkflowModal").html(data);
				$('#approveWorkflowDiv').modal('show');
			}
		},
		error: function(XMLHttpRequest, textStatus, errorThrown){
			redragonJS.alert(textStatus);
		}
	});
}


//返回审批记录
function getWorkflowRecordListModal(billType, billHeadCode){
	$.ajax({
		type: "post",
		url: "web/cuxWorkflowRecord/getWorkflowRecordListModal",
		data: {"billType": billType, "billHeadCode": billHeadCode},
		async: false,
		dataType: "html",
		cache: false,
		success: function(data){
			if(data!=""){
				$("#approveWorkflowModal").html(data);
				$('#workflowRecordDiv').modal('show');
			}
		},
		error: function(XMLHttpRequest, textStatus, errorThrown){
			redragonJS.alert(textStatus);
		}
	});
}